<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>测试 - layui</title>
    <link rel="stylesheet" href="layui/css/layui.css">
    <link rel="stylesheet" href="layui/css/main.css">
</head>

<body>
<ul class="layui-nav">
    <li class="layui-nav-item">
        <a href="me.html" id="appUserName"></a>
        <dl class="layui-nav-child">
            <dd><a href="javascript:;">修改信息</a></dd>
            <dd><a href="javascript:;">退了</a></dd>
        </dl>
    </li>
    <li class="layui-nav-item">
        <a href="dashboard.html">恩爱广场<span class="layui-badge">9</span></a>
    </li>
    <li class="layui-nav-item">
        <a href="friends.html">好友列表</a>
    </li>
    <li class="layui-nav-item">
        <a href="our.html">我俩专属</a>
    </li>
    <li class="layui-nav-item">
        <a href="write.html">说点什么</a>
    </li>
    <li class="layui-nav-item">
        <a href="game.html">玩玩小游戏</a>
    </li>
</ul>
<br>
<div class="layui-container">
    <blockquote class="layui-elem-quote">这是我</blockquote>
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md9">
            <form class="layui-form">
                <!-- 提示：如果你不想用form，你可以换成div等任何一个普通元素 -->
                <div class="layui-form-item">
                    <label class="layui-form-label">我的账号</label>
                    <div class="layui-input-block">
                        <input type="text" name="" placeholder="" autocomplete="off" class="layui-input" id="userId"
                               readonly="readonly">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">我的网名</label>
                    <div class="layui-input-block">
                        <input type="text" name="" placeholder="" autocomplete="off" class="layui-input" id="userNAme">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">我的头像</label>
                    <div class="layui-input-block">
                        <input type="text" name="" placeholder="" autocomplete="off" class="layui-input" id="userPic">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">个性签名</label>
                    <div class="layui-input-block">
                        <input type="text" name="" placeholder="" autocomplete="off" class="layui-input" id="userSign">
                    </div>
                </div>
            </form>
        </div>
        <div class="layui-col-md3">
            <div class="layui-panel">
                <div style="padding: 30px;">
                    留白，不知道放啥
                </div>
            </div>
        </div>
    </div>
</div>



<!-- 引入 layui.js 的 <script> 标签最好放置在 html 末尾 -->
<script src="layui/layui.js"></script>
<script src="layui/init.js"></script>
<script>
    layui.use(function () {
        var $ = layui.$;
        var layer = layui.layer;
        var userId = document.getElementById('userId')
        var userName = document.getElementById('userName')
        var userPassword = document.getElementById('userPassword')
        layer.msg('hello');
        $.ajax({
            type: "GET",
            url: "http://localhost/note/user/findMe?accountId="+localStorage.getItem('userId'),
            headers: {
                token: localStorage.getItem('userToken')
            },
            success: function (data) {
                var jsonStr = JSON.stringify(data);
                var obj = JSON.parse(jsonStr)
                console.log("刚开始的data" + obj.userName)
                userId.setAttribute("placeholder",obj.userId)
                // userName.setAttribute("placeholder",obj.userName)
            },
            error: function (data) {
                console.log(data)
                layer.msg(JSON.stringify(data))
                window.location.replace("http://localhost/login.html");
            }
        });
    });
</script>
</body>

</html>